
#include <cassert>
#include <iostream>
#include <vector>

using namespace std;

#include <chrono>
#include <cstdio>
void MyTimer(int type, const char *info = nullptr) {
  static std::chrono::steady_clock::time_point start;
  if (type == 0) {
    start = std::chrono::steady_clock::now();
    printf("Begin %s\n", info);
    return;
  } else {
    auto end = std::chrono::steady_clock::now();
    auto dt =
        std::chrono::duration_cast<std::chrono::duration<double>>(end - start);
    printf("End %s, time taken=%lf\n", info, dt.count());
  }
}

int main() {
  int n = 10000000;
  vector<double> v1, v2;

  int c1, c11;
  MyTimer(0, "start from 0");
  c11 = c1 = v1.capacity();
  for (int i = 0; i < n; ++i) {
    v1.emplace_back(i * 0.1);
    c11 = v1.capacity();
    if (c11 != c1) {
      cout << c11 << "\n";
      c1 = c11;
    }
  }
  MyTimer(1, "end");
  MyTimer(0, "start from 1024");
  v2.resize(4096);
  //   cout << v2.capacity() << endl;
  v2.resize(0);
  //   cout << v2.capacity() << endl;
  for (int i = 0; i < n; ++i) {
    v2.emplace_back(i * 0.1);
  }
  MyTimer(1, "end");
  for (int i = 0; i < n; ++i)
    if (v1[i] != v2[i]) {
      cout << "not equal\n";
      break;
    }

  vector<double> dvec;
  dvec.reserve(10000);
  cout << dvec.capacity() << endl;
  return 0;
}